package simpleTaskBoard.dto;

import java.io.Serializable;

import simpleTaskBoard.entities.TaskEntity;

public class TaskDTO implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3052708660637937284L;
	private Long id;
	private String title;
	private String description;
	private String assigned;
	private String status;
	private String createdBy;

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getAssigned() {
		return assigned;
	}
	public void setAssigned(String assigned) {
		this.assigned = assigned;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	
	public TaskDTO(TaskEntity task) {
		this.id = task.getId();
		this.title = task.getTitle();
		this.description = task.getDescription();
		this.assigned = task.getAssigned();
		this.status = task.getStatus();
		this.createdBy = task.getCreatedBy();
	}
	
	public TaskDTO(){
		
	}
	public TaskEntity convertToEntity(TaskDTO task){
		TaskEntity taskEntity = new TaskEntity();
		if( task.getId()!=null && task.getId()>0)
		{
			taskEntity.setId(task.getId());
		}
		taskEntity.setAssigned(task.getAssigned());
		taskEntity.setDescription(task.getDescription());
		taskEntity.setStatus(task.getStatus());
		taskEntity.setTitle(task.getTitle());
		taskEntity.setCreatedBy(task.getCreatedBy());
		return taskEntity;
	}
	public String getCreatedBy() {
		return createdBy;
	}
	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}
}
